import request from '@/utils/request'

// 货主管理

// 获取列表接口
export const getList = (data) => request.get('/api/owner/page', {
  params: {
    id: data.id,
    like_code: data.like_code,
    like_name: data.like_name,
    like_personName: data.like_personName,
    size: 10,
    current: 1,
    descs: 'createTime'
  }
})

export const getCode = () => request.get('/api/codeFactory/next/HZ')

export const add = (data) => request.post('/api/owner', data)

export const getEditList = (id) => request.get(`/api/owner/detail/${id}`)

export const edit = (data) => request.put('/api/owner', data)

export const getStatus = () => request.get('/api/warehouse/list?status=1')

export const getTree = (id) => request.get('/api/area/tree', {
  params: {
    仓库id: id
  }
})

export const getAddList = (data) => request.post('/api/ownerLocation/batch', { idStrArray: [data[0].join(',')], ownerId: data[1] })

export const getDetail = (data) => request.get('/api/ownerLocation/pageDetail', {
  params: {
    current: data.current,
    size: data.size,
    ownerId: data.ownerId
  }
})

export const cancle = (id) => request.delete(`/api/ownerLocation?ids[]=${id}`)
